perm filename TEST.SAI[HAK,ROB]1 blob sn#461589 filedate 1979-07-25 generic text, type T, neo UTF8
BEGIN "TEST"

REQUIRE "{}<>" DELIMITERS;
LET ⊂ = BEGIN, ⊃ = END;
DEFINE !={COMMENT};
DEFINE
  SP={" "}, CR={('15&"")}, LF={('12&"")}, ↓={(CR&LF)}, TAB={('11&"")},
  FF={('14&"")}, ALT={('175&"")};
DEFINE comma = {(", ")};
DEFINE THRU={STEP 1 UNTIL};

DEFINE PI = { 3.1415926536 };
DEFINE pos_int_infinity = { '377777777777 }; ! = 34359738367;
DEFINE neg_int_infinity = { '400000000000 }; ! = -34359738368;
DEFINE pos_real_infinity = {  1.70141182@38 }; ! just weird numbers that work;
DEFINE neg_real_infinity = { -1.69808878@38 };

DEFINE Quit = { BEGIN CALL(1,"EXIT"); END };

RECORD_CLASS foo (REAL x; INTEGER mfun);

SIMPLE STRING PROCEDURE CalString(INTEGER fn; REAL x);
  ⊂ "CalStr"
    STRING s;
    START_CODE
 	PUSH	'17,-1('17)	; ! Stuff x;
 	PUSHJ	'17,@-3('17)	; ! Call fn(x);
 	MOVEI	1,s		; ! SAIL can't do addressing arithmetic;
 	POP	'16,(1)		; ! S ← fn(x);
 	POP	'16,-1(1) 	;
    END;
    RETURN(s);
  ⊃ "CalStr";

STRING PROCEDURE footxt(REAL val);
  ⊂ STRING s; s ← "hi"; RETURN(s); ⊃;

REAL R1,R2,R3;
RECORD_POINTER(foo) xyzzy;
STRING S1,S2;
INTEGER I1;

footxt(9.2);
S1 ← footxt(9.1);
S2 ← CalString(LOCATION(footxt),9.0);
PRINT("S1 = ",S1,"	S2 = ",S2,↓);

END "TEST"